<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">



 <xsl:template match="DVWPPage">
 
	<h1>
		FileName: <xsl:value-of select="FileName"/>
	</h1>

	<h2>CSS Links</h2>
	<ul>
	<xsl:for-each select="CSSLinks/CSS">
		<li><xsl:value-of select="./Source"/>
			(media: <xsl:value-of select="./Media"/>)
		</li>
	</xsl:for-each>
	</ul>
	
	<h2>Javascript Links</h2>
	<ul>
	<xsl:for-each select="JavaScriptLinks/JavaScript">
		<li><xsl:value-of select="."/></li>
	</xsl:for-each>
	</ul>
	
	<h2>DVWPs</h2>
	

	<xsl:for-each select="DVWPs/DVWP">
		<ul>
			<li>
				Title: <xsl:value-of select="translate(Title,'&quot;','')"/>
				
			</li>
			<li>Parameter Bindings:<br/>
				<table style="border:1px solid black;border-collapse:collapse">
					<thead>
						<tr>
							<th style="border:1px solid black">Name</th>
							<th style="border:1px solid black">Location</th>
							<th style="border:1px solid black">Default Value</th>
						</tr>
					</thead>
					<tbody>
						<xsl:for-each select="ParameterBindings/ParameterBinding">
							<tr>
								<td style="border:1px solid black">
									<xsl:value-of select="./Name"/>
								</td>
								<td style="border:1px solid black">
									<xsl:value-of select="./Location"/>
								</td>
								<td style="border:1px solid black">
									<xsl:value-of select="./DefaultValue"/>
								</td>								
							</tr>
						</xsl:for-each>
					</tbody>
				</table>
			</li>
			<li>
				XSL Imports:<br/>
				<ul>
					<xsl:for-each select="XSLImports/XSLImport">
						<li>
							<xsl:value-of select="./Source"/>
						</li>
					</xsl:for-each>
				</ul>
			</li>
			<li>List Data Sources:<br/>
				<table style="border:1px solid black;border-collapse:collapse">
					<thead>
						<tr>
							<th style="border:1px solid black">DataSource Type</th>
							<th style="border:1px solid black">Parameters</th>
							<th style="border:1px solid black">CAML View</th>
							<th style="border:1px solid black">CAML Filter</th>
						</tr>
					</thead>
					<tbody>
						<xsl:for-each select="DataSources/DataSource">
							<tr>
								<td style="border:1px solid black">
									<xsl:value-of select="./DataSourceType"/>
								</td>
								<td style="border:1px solid black">
									<ul>
										<xsl:if test="./DataSourceType='SOAP'">
											<li>
												<xsl:text>WSDLPath:</xsl:text>
												<xsl:value-of select="./WSDLPath"/>
											</li>
										</xsl:if>
										
										<xsl:for-each select="Parameters/KeyValue">
											<li>
												<xsl:value-of select="translate(Key,'&quot;','')"/>: 
												<xsl:value-of select="translate(Value,'&quot;','')"/>
											</li>
										</xsl:for-each>
									</ul>
								</td>
								<td style="border:1px solid black">


<xsl:choose>
	<xsl:when test="contains(CAMLQuery,'&lt;ViewFields&gt;')">
	   		
	</xsl:when>
	<xsl:otherwise>
		<xsl:text>All fields</xsl:text>	
	</xsl:otherwise>
</xsl:choose>	

								</td>
<td style="border:1px solid black">

	
<xsl:choose>
	<xsl:when test="contains(CAMLQuery,'/Query')">

<xsl:variable name="temp">
<xsl:value-of select="translate(CAMLQuery,'&quot;','')"/>
</xsl:variable>

<xsl:value-of select="substring-after($temp,'&lt;Query&gt;')"/>
	   	
	</xsl:when>
	<xsl:otherwise>
		<xsl:text>No Query</xsl:text>	
	</xsl:otherwise>
</xsl:choose>




</td>
							</tr>
						</xsl:for-each>
					</tbody>
				</table>
			</li>
		</ul>
	</xsl:for-each>

	
	
	
 </xsl:template>


 
 </xsl:stylesheet>